// Copyright (C) 2009 European Central Bank. All rights reserved.
//
// Redistribution and use in source and binary forms,

import aaa = module("main/org/sdmx/model/v2/reporting/dataset/AttachableArtefactAdapter");
import kvc = module("main/org/sdmx/model/v2/reporting/dataset/KeyValuesCollection");
import ixsc = module("main/org/sdmx/model/v2/reporting/dataset/IXSComponent");

import kd = module("main/org/sdmx/model/v2/structure/keyfamily/KeyDescriptor");

//import org.sdmx.model.v2.structure.keyfamily.KeyDescriptor;
	
/**
	* Base implementation of the contract defined in the IXSComponent 
	* interface.
	*  
	* @author Xavier Sosnovsky, Anthony Morel
	* @author Karine Feraboli
	*/ 
export class BaseXSComponent extends aaa.AttachableArtefactAdapter 
	implements ixsc.IXSComponent
{
	/*==============================Fields================================*/	
		
	/**
		* @private
		*/
	private _keyValues:kvc.KeyValuesCollection;
		
	/**
		* @private
		*/
	private _valueFor:kd.KeyDescriptor;
		
	/*===========================Constructor==============================*/
		
	constructor()
	{
		super();
	}
		
	/*============================Accessors===============================*/
		
	/**
		* @inheritDoc
		*/
	public setKeyValues(keyValues:kvc.KeyValuesCollection) {
		this._keyValues = keyValues;
	}
		
	/**
		* @inheritDoc
		*/
	public getKeyValues():kvc.KeyValuesCollection {
        return this._keyValues;
	}		
		
	/**
		* @inheritDoc
		*/
	public setValueFor(keyDescriptor:kd.KeyDescriptor) {
		if (null == keyDescriptor) {
			throw new Error("The key descriptor cannot be null");
		} else {
            this._valueFor = keyDescriptor;
		}
	}
		
	/**
		* @inheritDoc
		*/ 
	public getValueFor():kd.KeyDescriptor {
        return this._valueFor;
	}
}